import { createStore, createLogger } from 'vuex'
import createPersistedstate from 'vuex-persistedstate'
import user from './modules/user'
import cart from './modules/cart'
import category from './modules/category'
import * as Cookies from 'js-cookie'
// import cookie from 'cookie'
export default createStore({
  state: {
  },
  mutations: {
  },
  actions: {
  },
  modules: {
    user,
    cart,
    category
  },
  getters: {

  },
  plugins: [
    createPersistedstate({
      key: 'rabbit-133',
      paths: ['user', 'cart'],
      storage: {
        getItem: (key) => {
          return Cookies.get(key)
        },
        setItem: (key, value) => {
          return Cookies.set(key, value)
        },
        removeItem: Key => Cookies.remove(Key)
      }
    }),
    createLogger()
  ]
})
